#ifndef HEIGHTMAP_H
#define HEIGHTMAP_H

#include "../Config/Export.h"
#include "../Core/IDrawable.h"
#include "../Core/Texture.h"
#include "../Core/TMesh.h"

namespace epix {
	
template<class Drawer>
class SHARED THeightmap : public TMesh<Drawer>
{
	public:
	
		THeightmap();
		THeightmap(const float *data, int ncols, int nrows, float deep = 1.0);
		~THeightmap();
		
		void load(const float *data, int ncols, int nrows, float deep = 1.0);
		
		void genNormals();
		void genTexCoords(int revert = 0);
		
		virtual void draw();

	private:
	
		virtual void create();
		
		unsigned int _ncols, _nrows;
		float _deep;
		
		const float *_data;
	
};

#include "THeightmap.inl"

}

#endif
